package com.jbm.onehome.iface;

import com.jbm.core.iface.IAcross;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;

/**
 * Created by root on 17-5-19.
 */
@Entity
@Table(name = "contact", schema = "", catalog = "")
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true)
public class ContactEntity extends IAcross
{
	private int contactId;
	private int selfId;
	private Integer loginId;
	private Integer memberId;
	private Integer sellerId;
	private String status;
	private Timestamp createDate;
	private int createId;

	@Transient
	private List<ContactEntity> contactList;

	@Transient
	public String getAccount()
	{
		return account;
	}

	@Transient
	public void setAccount(String account)
	{
		this.account = account;
	}

	@Transient
	public String getNickname()
	{
		return nickname;
	}

	@Transient
	public void setNickname(String nickname)
	{
		this.nickname = nickname;
	}

	@Transient
	public String getFullname()
	{
		return fullname;
	}

	@Transient
	public void setFullname(String fullname)
	{
		this.fullname = fullname;
	}

	@Transient
	public String getMobile()
	{
		return mobile;
	}

	@Transient
	public void setMobile(String mobile)
	{
		this.mobile = mobile;
	}

	@Transient
	public String getMember()
	{
		return member;
	}

	@Transient
	public void setMember(String member)
	{
		this.member = member;
	}

	@Transient
	public String getSeller_code()
	{
		return seller_code;
	}

	@Transient
	public void setSeller_code(String seller_code)
	{
		this.seller_code = seller_code;
	}

	@Transient
	public String getSeller_name()
	{
		return seller_name;
	}

	@Transient
	public void setSeller_name(String seller_name)
	{
		this.seller_name = seller_name;
	}

	@Transient
	public String getSeller_mobile()
	{
		return seller_mobile;
	}

	@Transient
	public void setSeller_mobile(String seller_mobile)
	{
		this.seller_mobile = seller_mobile;
	}

	@Transient
	private String account;
	@Transient
	private String nickname;
	@Transient
	private String fullname;
	@Transient
	private String mobile;
	@Transient
	private String member;
	@Transient
	private String seller_code;
	@Transient
	private String seller_name;
	@Transient
	private String seller_mobile;

	@Transient
	public String getLogo()
	{
		return logo;
	}

	@Transient
	public void setLogo(String logo)
	{
		this.logo = logo;
	}

	@Transient
	private String logo;

	public ContactEntity()
	{
		super();
	}

	public ContactEntity(IAcross ia)
	{
		super(ia);
	}

	public ContactEntity(int code, String info)
	{
		super(code,info);
	}

	@Id
	@Column(name = "contact_id", nullable = false)
	@GeneratedValue
	public int getContactId()
	{
		return contactId;
	}

	public void setContactId(int contactId)
	{
		this.contactId = contactId;
	}

	@Basic
	@Column(name = "self_id", nullable = false)
	public int getSelfId()
	{
		return selfId;
	}

	public void setSelfId(int selfId)
	{
		this.selfId = selfId;
	}

	@Basic
	@Column(name = "login_id", nullable = true)
	public Integer getLoginId()
	{
		return loginId;
	}

	public void setLoginId(Integer loginId)
	{
		this.loginId = loginId;
	}

	@Basic
	@Column(name = "member_id", nullable = true)
	public Integer getMemberId()
	{
		return memberId;
	}

	public void setMemberId(Integer memberId)
	{
		this.memberId = memberId;
	}

	@Basic
	@Column(name = "seller_id", nullable = true)
	public Integer getSellerId()
	{
		return sellerId;
	}

	public void setSellerId(Integer sellerId)
	{
		this.sellerId = sellerId;
	}

	@Basic
	@Column(name = "status", nullable = true, length = 10)
	public String getStatus()
	{
		return status;
	}

	public void setStatus(String status)
	{
		this.status = status;
	}

	@Basic
	@Column(name = "create_date", nullable = true)
	public Timestamp getCreateDate()
	{
		return createDate;
	}

	public void setCreateDate(Timestamp createDate)
	{
		this.createDate = createDate;
	}

	@Basic
	@Column(name = "create_id", nullable = false)
	public int getCreateId()
	{
		return createId;
	}

	public void setCreateId(int createId)
	{
		this.createId = createId;
	}

	@Transient
	public List<ContactEntity> getContactList()
	{
		return contactList;
	}

	@Transient
	public void setContactList(List<ContactEntity> contactList)
	{
		this.contactList = contactList;
/*
		this.contactList = new ContactEntity[contactList.length];
		for( int i = 0;i < contactList.length; i ++ )
			this.contactList[i] = (ContactEntity)contactList[i];
*/
	}

	@Override
	public boolean equals(Object o)
	{
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		ContactEntity that = (ContactEntity) o;

		if (contactId != that.contactId) return false;
		if (selfId != that.selfId) return false;
		if (createId != that.createId) return false;
		if (loginId != null ? !loginId.equals(that.loginId) : that.loginId != null) return false;
		if (memberId != null ? !memberId.equals(that.memberId) : that.memberId != null) return false;
		if (sellerId != null ? !sellerId.equals(that.sellerId) : that.sellerId != null) return false;
		if (status != null ? !status.equals(that.status) : that.status != null) return false;
		if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;

		return true;
	}

	@Override
	public int hashCode()
	{
		int result = contactId;
		result = 31 * result + selfId;
		result = 31 * result + (loginId != null ? loginId.hashCode() : 0);
		result = 31 * result + (memberId != null ? memberId.hashCode() : 0);
		result = 31 * result + (sellerId != null ? sellerId.hashCode() : 0);
		result = 31 * result + (status != null ? status.hashCode() : 0);
		result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
		result = 31 * result + createId;
		return result;
	}

	public ContactEntity(int contactId)
	{
		this.contactId = contactId;
	}

	public ContactEntity(int selfId, Integer loginId, Integer memberId, Integer sellerId)
	{
		this.selfId = selfId;
		this.loginId = loginId;
		this.memberId = memberId;
		this.sellerId = sellerId;
	}
}
